<script>
	upload.type='court';
	upload.formid='courtForm';
	upload.setAppend=function(imgurl){
		return '<div style="margin:10px"><a href="'+imgurl+'" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="'+imgurl+'" /></a> Photo information:<input type="text" name="imgIntro[]" value="" /><input type="hidden" name="imgUrl[]" value="'+imgurl+'" />　<input type="button" value="Insert" onclick="commonEffection.InserImg(\''+imgurl+'\');" />　<input type="button" value="Delete" onclick="upload.delimg(this);" /></div>';
	}
</script>
<div class="frame_introDiv">
<form name="courtForm" id="courtForm" action="adminb-court-doedit?itemid=<?=$this->itemArray[0]['itemid']?>" enctype="multipart/form-data"  method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td width="20%" class="ri-bbgg"> Case name</td>
      <td width="80%" class="le">
	  	<input type="text" value="<?=$this->itemArray[0]['subject']?>" name="court_name" />
		<?if($this->itemArray[0]['flid']=='3'):?>
			<br /><a target="_blank" href="court?itemid=<?=$this->itemArray[0]['itemid']?>">Case is in trial, click and enter to view the trial process</a>
		<?endif;?>
	  </td>
    </tr>
	<tr>
      <td class="ri-bbgg"> The defendant username</td>
      <td class="le"><input type="text" value="<?=$this->defendant_username?>" name="defendant_username" /></td>
    </tr>
	<tr>
      <td class="ri-bbgg"> The defendant username</td>
      <td class="le">
		<?if($this->itemArray[0]['win_uid']==$this->itemArray[0]['complainant_uid']):?>
			<?=$this->complainant_username?>
		<?elseif($this->itemArray[0]['win_uid']==$this->itemArray[0]['defendant_uid']):?>
			<?=$this->defendant_username?>
		<?else:?>
			No winner temporarily
		<?endif;?>
		&nbsp;&nbsp;
		<?if($this->itemArray[0]['win_uid']==$this->itemArray[0]['defendant_uid']):?>
			<?if($this->itemArray[0]['sentence_time']+3600*24*15>time()):?>
			<input onclick="parent.userPmInfo.mustFlid='5';parent.userPmInfo.subject='I would like to appeal this case:<?=$this->itemArray[0]['subject']?>';parent.userPmInfo.caseitemid='<?=$this->itemArray[0]['itemid']?>';parent.userPmInfo.sendTo='admin';parent.userPmInfo.show();" type="button" value="I would like to appeal" />
			<?else:?>
			Appeal period has exceeded
			<?endif;?>
		<?endif;?>
	  </td>
    </tr>
	<tr>
      <td class="ri-bbgg"> Case introduction</td>
      <td class="le">
	  	<textarea name="case_intro" style="width:500px;height:100px"><?=$this->itemArray[0]['case_intro']?></textarea>
	  </td>
    </tr>
	<tr>
      <td class="ri-bbgg"> Prosecution content</td>
      <td class="le">
	  	<?=$this->oFCKeditor->create();?>
	  </td>
    </tr>
	<tr>
	  <td class="ri-bbgg"><span class="red">*</span> Upload the picture：</td>
	  <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="upload.uploadimg(this);" value="Upload" />　( You can upload several photos )</td>
	</tr>
	<tr>
	  <td class="ri-bbgg">Photo effects：</td>
	  <td class="le">
		<div id="productImages">
		<?for($i=0;$i<count($this->attachmentArray);$i++):?>
				<div style="margin:10px"><a href="<?=$this->attachmentArray[$i]['attachment_url']?>" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->attachmentArray[$i]['attachment_url']?>" /></a> Photo information:<input type="text" name="imgIntro[]" value="<?=$this->attachmentArray[$i]['intro']?>" /><input type="hidden" name="imgUrl[]" value="<?=$this->attachmentArray[$i]['attachment_url']?>" />　<input type="button" value="Insert" onclick="commonEffection.InserImg('<?=$this->attachmentArray[$i]['attachment_url']?>');" />　<input type="button" value="delete" onclick="upload.delimgbyid(this);" /><input type="hidden" value="<?=$this->attachmentArray[$i]['attachmentid']?>" name="attachmentid[]" /></div>
		<?endfor;?>
		</div>
		<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
	</tr>
	<tr>
      <td class="ri-bbgg"> The points you ask the defendant for compensation </td>
	  <td class="le">
	   <input value="<?=$this->itemArray[0]['compensation']?>" name="compensation" />
	  </td> 
	</tr>
	<tr>
      <td class="ri-bbgg"> The link of the products in question (Optional)</td>
	  <td class="le">
	   <input value="<?=$this->itemArray[0]['product_url']?>" name="product_url" /> (Please fill with the link of the products )
	  </td> 
	</tr>
	<tr>
      <td class="ri-bbgg"> Defendant content</td>
	  <td class="le">
	   <?if($this->itemArray[0]['defendant_content']!=''):?>
	     <div><?=$this->subStr($this->toText($this->itemArray[0]['defendant_content']),0,50)?></div>
		 <div><a target="blank" href="adminb-court-defendant?itemid=<?=$this->itemArray[0]['itemid']?>">Check it</a></div>
	   <?else:?>
	   	No material
	   <?endif;?>
	  </td> 
    </tr>
	<tr>
      <td class="ri-bbgg"> Case conclusion</td>
      <td class="le">
	  	<?if($this->itemArray[0]['conclusion']!=''):?>
	  	<div><?=$this->subStr($this->toText($this->itemArray[0]['conclusion']),0,50)?></div>
		<div><a target="blank" href="adminb-court-conclusion?itemid=<?=$this->itemArray[0]['itemid']?>">Check it</a></div>
		<?else:?>
		No conclusion temporarily
		<?endif;?>
	  </td>
    </tr>
	<tr>
      <td class="ri-bbgg"> The time of the trial(Beijing time)</td>
	  <td class="le">
	  	<?if($this->itemArray[0]['judge_time']=='0'):?>
			Not yet determined the time of the trial
		<?else:?>
	   		<?=date('Y-m-d H:i:s',$this->itemArray[0]['judge_time'])?>
		<?endif;?>
	  </td> 
    </tr>
	<tr>
      <td class="ri-bbgg"> Judge time(Beijing time)</td>
	  <td class="le">
	  	<?if($this->itemArray[0]['sentence_time']=='0'):?>
			Not yet to determine the judge time
		<?else:?>
	   		<?=date('Y-m-d H:i:s',$this->itemArray[0]['sentence_time'])?>
		<?endif;?>
	  </td> 
    </tr>
	<tr>
      <td class="ri-bbgg"> Case state</td>
	  <td class="le">
	   <?=$this->itemArray[0]['flname']?>
	  </td> 
    </tr>
	<?if($this->itemArray[0]['flid']=='1'):?>
    <tr>
      <td colspan="2" class="se" style="text-align:center"><span>
        <input name="button2" type="button" class="iput" onclick="checkform();" value="Save" />&nbsp;&nbsp;
      </span><font color="#FF0000"></font></td>
    </tr>
	<?else:?>
	<tr>
      <td colspan="2" class="se" style="text-align:center">
	  	The case has been approved, and can not be modified!
	  </td>
    </tr>
	<?endif;?>
  </table>
  </form>
</div>
<script>
$('input[name="win_uid"]').each(
	function(){
		if($(this).val()=='<?=$this->itemArray[0]['win_uid']?>'){
			$(this).attr('checked',true);
		}
	}
);
function checkform(){
	var court_name=trim($('input[name="court_name"]').val());
	if(court_name==''){
		alert('Please fill in the name of cases!');
		return false;
	}
	var defendant_username=trim($('input[name="defendant_username"]').val());
	if(defendant_username==''){
		alert('Please fill in the defendant name!');
		return false;
	}
	var case_intro=trim($('textarea[name="case_intro"]').val());
	if(case_intro==''){
		alert('Please fill in the case introduction!');
		return false;
	}
	var compensation=trim($('input[name="compensation"]').val());
	if(!numTest(compensation)){
		alert('Please fill in the compensation!');
		return false;
	}else if(compensation>100000){
		alert('Compensation points should not be more than 100000!');
		return false;
	}
	var content = trim(FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML( true ));
	if(content==''){
		alert('Please fill in the prosecution content!');
		return false;
	}
	$('#courtForm').submit();
}
</script>